<?php


if(isset($_GET['domainID'])) {
    $domainID = $_GET['domainID'];
    $db = mysql_connect('localhost', 'boughtns_user', 'GodLovesYou!');
    
    if (!$db) {
        die('Could not connect: ' . mysql_error());
    }
    
    mysql_select_db('boughtns_mas', $db);
    
    $query = "SELECT * FROM subdomain where domain_id = " . $domainID;
   // echo $query;
    
    $result = mysql_query($query);
    echo mysql_error();
    
    $dataArray = array();
    
    while($row = mysql_fetch_assoc($result)) 
    {
        $id = $row['subdomain_id'];
        $name = $row['subdomain_name'];
        $json = new JsonObj;
        $json->subDomainID = $id;
        $json->subDomainName = $name;
        array_push($dataArray,$json);
    }
    
    
    
    echo json_encode($dataArray);
    
    mysql_close($db);

}


class jsonObj
{
    public $subDomainID;
    public $subDomainName;
    
}    

?>